package com.lagou.edu.test;

public class Tools {
	private Tools() {
	}

	private static Tools tools = new Tools();

	public static Tools getInstance() {
		return tools;
	}

	private InheritableThreadLocal<String> threadLocal = new InheritableThreadLocal();

	public String getThreadVarable() {
		String variable = threadLocal.get();
		if (variable == null) {
			threadLocal.set("线程" + Thread.currentThread().getName() + "的变量");
			variable = threadLocal.get();
		}
		return variable;
	}
}
